/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * NLPcpu.java
 *
 * Created on Mar 3, 2011, 1:47:45 AM
 */

package annotate.gui;

import UserInterface.TabGuard;
import java.awt.Toolkit;

/**
 *
 * @author Chris
 */
public class NLPcpu extends javax.swing.JPanel
{
    /**point to parent frame*/
    protected UserInterface.GUI __gui;

    /**Current thread of annotation generation. It can be used to stop the thread when necessary*/
    private Thread annotationGenerationThread = null;

    /** Creates new form NLPcpu */
    public NLPcpu(UserInterface.GUI _gui) {
        this.__gui = _gui;
        
        initComponents();
        resetRunningStatus();
        jComboBox_processedfilelist.setEditable(false);
        jComboBox_processedfilelist.setEnabled(false);
        jLabel8.setText( env.Parameters.NLPAssistant.outputpath );
        jButton_back.setEnabled(false);
        jButton_stop.setText("Stop");
   
    }

    public static javax.swing.JTextPane getLogTextPane() {
        return jTextPane_log;
    }
    

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel_top = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jPanel_topbackground = new javax.swing.JPanel();
        jPanel_topbound = new javax.swing.JPanel();
        jPanel_left = new javax.swing.JPanel();
        jLabel_s = new javax.swing.JLabel();
        jLabel_t = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jPanel_right = new javax.swing.JPanel();
        jPanel8 = new javax.swing.JPanel();
        jLabel_status = new javax.swing.JLabel();
        jPanel7 = new javax.swing.JPanel();
        jLabel_taskdescription = new javax.swing.JLabel();
        jPanel10 = new javax.swing.JPanel();
        jLabel_currentcorpusfile = new javax.swing.JLabel();
        jPanel11 = new javax.swing.JPanel();
        jProgressBar1 = new javax.swing.JProgressBar();
        jPanel14 = new javax.swing.JPanel();
        jLabel8 = new javax.swing.JLabel();
        jPanel_Buttom = new javax.swing.JPanel();
        jButton_stop = new javax.swing.JButton();
        jButton_back = new javax.swing.JButton();
        jPanel_center = new javax.swing.JPanel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel4 = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jPanel16 = new javax.swing.JPanel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        jLabel23 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        jPanel17 = new javax.swing.JPanel();
        jPanel18 = new javax.swing.JPanel();
        jLabel_totalfiles = new javax.swing.JLabel();
        jPanel19 = new javax.swing.JPanel();
        jLabel_allconcepts = new javax.swing.JLabel();
        jPanel20 = new javax.swing.JPanel();
        jLabel_allssn = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jComboBox_processedfilelist = new javax.swing.JComboBox();
        jPanel27 = new javax.swing.JPanel();
        jLabel_concepts = new javax.swing.JLabel();
        jPanel34 = new javax.swing.JPanel();
        jLabel_ssn = new javax.swing.JLabel();
        jPanel35 = new javax.swing.JPanel();
        jLabel_date = new javax.swing.JLabel();
        jPanel36 = new javax.swing.JPanel();
        jLabel_customregex = new javax.swing.JLabel();
        jPanel15 = new javax.swing.JPanel();
        jPanel22 = new javax.swing.JPanel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jPanel23 = new javax.swing.JPanel();
        jPanel24 = new javax.swing.JPanel();
        jLabel_processedfiles = new javax.swing.JLabel();
        jPanel25 = new javax.swing.JPanel();
        jLabel_totaldate = new javax.swing.JLabel();
        jPanel26 = new javax.swing.JPanel();
        jLabel_allcustomregex = new javax.swing.JLabel();
        jPanel9 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTextPane_log = new javax.swing.JTextPane();

        setBorder(javax.swing.BorderFactory.createMatteBorder(4, 6, 1, 6, new java.awt.Color(255, 255, 254)));
        setLayout(new java.awt.BorderLayout());

        jPanel_top.setBackground(new java.awt.Color(255, 255, 254));
        jPanel_top.setLayout(new java.awt.BorderLayout());

        jPanel6.setBackground(new java.awt.Color(0, 51, 102));
        jPanel6.setLayout(new java.awt.BorderLayout());

        jLabel1.setFont(new java.awt.Font("Calibri", 1, 13));
        jLabel1.setForeground(new java.awt.Color(204, 204, 204));
        jLabel1.setText("  Searching concepts using NLP assistant ...");
        jLabel1.setMaximumSize(new java.awt.Dimension(34, 22));
        jLabel1.setMinimumSize(new java.awt.Dimension(34, 22));
        jLabel1.setPreferredSize(new java.awt.Dimension(34, 22));
        jPanel6.add(jLabel1, java.awt.BorderLayout.CENTER);

        jPanel_top.add(jPanel6, java.awt.BorderLayout.PAGE_START);

        jPanel_topbackground.setBorder(javax.swing.BorderFactory.createMatteBorder(5, 0, 5, 0, new java.awt.Color(255, 255, 254)));
        jPanel_topbackground.setLayout(new java.awt.BorderLayout());

        jPanel_topbound.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));
        jPanel_topbound.setLayout(new java.awt.BorderLayout());

        jPanel_left.setBackground(new java.awt.Color(240, 240, 241));
        jPanel_left.setLayout(new java.awt.GridLayout(5, 1));

        jLabel_s.setFont(new java.awt.Font("Calibri", 1, 12));
        jLabel_s.setForeground(new java.awt.Color(51, 51, 51));
        jLabel_s.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel_s.setText("Status");
        jLabel_s.setMaximumSize(new java.awt.Dimension(150, 22));
        jLabel_s.setMinimumSize(new java.awt.Dimension(150, 22));
        jLabel_s.setPreferredSize(new java.awt.Dimension(150, 22));
        jPanel_left.add(jLabel_s);

        jLabel_t.setFont(new java.awt.Font("Calibri", 1, 12));
        jLabel_t.setForeground(new java.awt.Color(51, 51, 51));
        jLabel_t.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel_t.setText("Task Description:");
        jLabel_t.setMaximumSize(new java.awt.Dimension(150, 22));
        jLabel_t.setMinimumSize(new java.awt.Dimension(150, 22));
        jLabel_t.setPreferredSize(new java.awt.Dimension(150, 22));
        jPanel_left.add(jLabel_t);

        jLabel6.setFont(new java.awt.Font("Calibri", 1, 12));
        jLabel6.setForeground(new java.awt.Color(51, 51, 51));
        jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel6.setText("Current Corpus File:");
        jLabel6.setMaximumSize(new java.awt.Dimension(150, 22));
        jLabel6.setMinimumSize(new java.awt.Dimension(150, 22));
        jLabel6.setPreferredSize(new java.awt.Dimension(150, 22));
        jPanel_left.add(jLabel6);

        jLabel9.setFont(new java.awt.Font("Calibri", 1, 12));
        jLabel9.setForeground(new java.awt.Color(51, 51, 51));
        jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel9.setText("Progress");
        jLabel9.setMaximumSize(new java.awt.Dimension(150, 22));
        jLabel9.setMinimumSize(new java.awt.Dimension(150, 22));
        jLabel9.setPreferredSize(new java.awt.Dimension(150, 22));
        jPanel_left.add(jLabel9);

        jLabel10.setFont(new java.awt.Font("Calibri", 1, 12));
        jLabel10.setForeground(new java.awt.Color(51, 51, 51));
        jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel10.setText("XML output Directory:");
        jLabel10.setMaximumSize(new java.awt.Dimension(150, 22));
        jLabel10.setMinimumSize(new java.awt.Dimension(150, 22));
        jLabel10.setPreferredSize(new java.awt.Dimension(150, 22));
        jPanel_left.add(jLabel10);

        jPanel_topbound.add(jPanel_left, java.awt.BorderLayout.WEST);

        jPanel_right.setBackground(new java.awt.Color(240, 240, 241));
        jPanel_right.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 5, 0, 0, new java.awt.Color(240, 240, 241)));
        jPanel_right.setLayout(new java.awt.GridLayout(5, 0));

        jPanel8.setBackground(new java.awt.Color(239, 240, 240));
        jPanel8.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(153, 153, 153)));
        jPanel8.setMaximumSize(new java.awt.Dimension(32767, 22));
        jPanel8.setPreferredSize(new java.awt.Dimension(112, 22));
        jPanel8.setLayout(new java.awt.BorderLayout());

        jLabel_status.setFont(new java.awt.Font("Calibri", 0, 12));
        jLabel_status.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel_status.setText("Initialization --> Loading Dictionary --> Processing Article Contents --> Post Process --> End");
        jLabel_status.setMinimumSize(new java.awt.Dimension(150, 22));
        jLabel_status.setPreferredSize(new java.awt.Dimension(150, 22));
        jPanel8.add(jLabel_status, java.awt.BorderLayout.CENTER);

        jPanel_right.add(jPanel8);

        jPanel7.setBackground(new java.awt.Color(239, 240, 240));
        jPanel7.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(153, 153, 153)));
        jPanel7.setMaximumSize(new java.awt.Dimension(32767, 22));
        jPanel7.setPreferredSize(new java.awt.Dimension(112, 22));
        jPanel7.setLayout(new java.awt.BorderLayout());

        jLabel_taskdescription.setFont(new java.awt.Font("Calibri", 0, 12));
        jLabel_taskdescription.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel_taskdescription.setText("Clear memory (98%)");
        jLabel_taskdescription.setMinimumSize(new java.awt.Dimension(150, 22));
        jLabel_taskdescription.setPreferredSize(new java.awt.Dimension(150, 22));
        jPanel7.add(jLabel_taskdescription, java.awt.BorderLayout.CENTER);

        jPanel_right.add(jPanel7);

        jPanel10.setBackground(new java.awt.Color(239, 240, 240));
        jPanel10.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(153, 153, 153)));
        jPanel10.setMaximumSize(new java.awt.Dimension(32767, 22));
        jPanel10.setPreferredSize(new java.awt.Dimension(112, 22));
        jPanel10.setLayout(new java.awt.BorderLayout());

        jLabel_currentcorpusfile.setFont(new java.awt.Font("Calibri", 0, 12));
        jLabel_currentcorpusfile.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel_currentcorpusfile.setText("0087.txt");
        jLabel_currentcorpusfile.setMinimumSize(new java.awt.Dimension(150, 22));
        jLabel_currentcorpusfile.setPreferredSize(new java.awt.Dimension(150, 22));
        jPanel10.add(jLabel_currentcorpusfile, java.awt.BorderLayout.CENTER);

        jPanel_right.add(jPanel10);

        jPanel11.setBackground(new java.awt.Color(239, 240, 240));
        jPanel11.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(153, 153, 153)));
        jPanel11.setMaximumSize(new java.awt.Dimension(32767, 22));
        jPanel11.setPreferredSize(new java.awt.Dimension(112, 22));
        jPanel11.setLayout(new java.awt.BorderLayout());
        jPanel11.add(jProgressBar1, java.awt.BorderLayout.CENTER);

        jPanel_right.add(jPanel11);

        jPanel14.setBackground(new java.awt.Color(239, 240, 240));
        jPanel14.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(153, 153, 153)));
        jPanel14.setMaximumSize(new java.awt.Dimension(32767, 22));
        jPanel14.setPreferredSize(new java.awt.Dimension(112, 22));
        jPanel14.setLayout(new java.awt.BorderLayout());

        jLabel8.setFont(new java.awt.Font("Calibri", 0, 12));
        jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel8.setText("path");
        jLabel8.setMinimumSize(new java.awt.Dimension(150, 22));
        jLabel8.setPreferredSize(new java.awt.Dimension(150, 22));
        jPanel14.add(jLabel8, java.awt.BorderLayout.CENTER);

        jPanel_right.add(jPanel14);

        jPanel_topbound.add(jPanel_right, java.awt.BorderLayout.CENTER);

        jPanel_topbackground.add(jPanel_topbound, java.awt.BorderLayout.NORTH);

        jPanel_top.add(jPanel_topbackground, java.awt.BorderLayout.CENTER);

        jPanel_Buttom.setBackground(new java.awt.Color(239, 240, 240));
        jPanel_Buttom.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));

        jButton_stop.setText("Stop");
        jButton_stop.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton_stopActionPerformed(evt);
            }
        });

        jButton_back.setText("Back to Previous Step");
        jButton_back.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton_backActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel_ButtomLayout = new javax.swing.GroupLayout(jPanel_Buttom);
        jPanel_Buttom.setLayout(jPanel_ButtomLayout);
        jPanel_ButtomLayout.setHorizontalGroup(
            jPanel_ButtomLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel_ButtomLayout.createSequentialGroup()
                .addContainerGap(1549, Short.MAX_VALUE)
                .addComponent(jButton_back)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton_stop))
        );
        jPanel_ButtomLayout.setVerticalGroup(
            jPanel_ButtomLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel_ButtomLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(jButton_stop)
                .addComponent(jButton_back))
        );

        jPanel_top.add(jPanel_Buttom, java.awt.BorderLayout.PAGE_END);

        add(jPanel_top, java.awt.BorderLayout.NORTH);

        jPanel_center.setBackground(new java.awt.Color(240, 240, 239));
        jPanel_center.setBorder(javax.swing.BorderFactory.createMatteBorder(5, 0, 0, 0, new java.awt.Color(255, 255, 255)));
        jPanel_center.setLayout(new java.awt.BorderLayout());

        jTabbedPane1.setBackground(new java.awt.Color(255, 255, 254));
        jTabbedPane1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));
        jTabbedPane1.setTabPlacement(javax.swing.JTabbedPane.BOTTOM);

        jPanel4.setBackground(new java.awt.Color(240, 240, 239));
        jPanel4.setLayout(new java.awt.BorderLayout());

        jPanel1.setBackground(new java.awt.Color(240, 240, 239));
        jPanel1.setLayout(new java.awt.GridLayout(1, 2));

        jPanel2.setBackground(new java.awt.Color(240, 240, 239));
        jPanel2.setLayout(new java.awt.BorderLayout());

        jPanel16.setBackground(new java.awt.Color(240, 240, 239));
        jPanel16.setLayout(new java.awt.GridLayout(9, 1));

        jLabel12.setFont(new java.awt.Font("Calibri", 1, 12));
        jLabel12.setForeground(new java.awt.Color(51, 51, 51));
        jLabel12.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel12.setText("Total files:");
        jLabel12.setMaximumSize(new java.awt.Dimension(150, 22));
        jLabel12.setMinimumSize(new java.awt.Dimension(150, 22));
        jLabel12.setPreferredSize(new java.awt.Dimension(150, 22));
        jPanel16.add(jLabel12);

        jLabel13.setFont(new java.awt.Font("Calibri", 1, 12));
        jLabel13.setForeground(new java.awt.Color(51, 51, 51));
        jLabel13.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel13.setText("Found concepts:");
        jLabel13.setMaximumSize(new java.awt.Dimension(150, 22));
        jLabel13.setMinimumSize(new java.awt.Dimension(150, 22));
        jLabel13.setPreferredSize(new java.awt.Dimension(150, 22));
        jPanel16.add(jLabel13);

        jLabel14.setFont(new java.awt.Font("Calibri", 1, 12));
        jLabel14.setForeground(new java.awt.Color(51, 51, 51));
        jLabel14.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel14.setText("Found SSN:");
        jLabel14.setMaximumSize(new java.awt.Dimension(150, 22));
        jLabel14.setMinimumSize(new java.awt.Dimension(150, 22));
        jLabel14.setPreferredSize(new java.awt.Dimension(150, 22));
        jPanel16.add(jLabel14);

        jLabel18.setFont(new java.awt.Font("Calibri", 1, 12));
        jLabel18.setForeground(new java.awt.Color(51, 51, 51));
        jLabel18.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel18.setMaximumSize(new java.awt.Dimension(150, 22));
        jLabel18.setMinimumSize(new java.awt.Dimension(150, 22));
        jLabel18.setPreferredSize(new java.awt.Dimension(150, 22));
        jPanel16.add(jLabel18);

        jLabel19.setFont(new java.awt.Font("Calibri", 1, 12));
        jLabel19.setForeground(new java.awt.Color(51, 51, 51));
        jLabel19.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel19.setText("<html><b>Current processing file:</b></html>");
        jLabel19.setMaximumSize(new java.awt.Dimension(150, 22));
        jLabel19.setMinimumSize(new java.awt.Dimension(150, 22));
        jLabel19.setPreferredSize(new java.awt.Dimension(150, 22));
        jPanel16.add(jLabel19);

        jLabel21.setFont(new java.awt.Font("Calibri", 1, 12));
        jLabel21.setForeground(new java.awt.Color(51, 51, 51));
        jLabel21.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel21.setText("<html><b>Found concepts:</b></html>");
        jLabel21.setMaximumSize(new java.awt.Dimension(150, 22));
        jLabel21.setMinimumSize(new java.awt.Dimension(150, 22));
        jLabel21.setPreferredSize(new java.awt.Dimension(150, 22));
        jPanel16.add(jLabel21);

        jLabel22.setFont(new java.awt.Font("Calibri", 1, 12));
        jLabel22.setForeground(new java.awt.Color(51, 51, 51));
        jLabel22.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel22.setText("Found SSN:");
        jLabel22.setMaximumSize(new java.awt.Dimension(150, 22));
        jLabel22.setMinimumSize(new java.awt.Dimension(150, 22));
        jLabel22.setPreferredSize(new java.awt.Dimension(150, 22));
        jPanel16.add(jLabel22);

        jLabel23.setFont(new java.awt.Font("Calibri", 1, 12));
        jLabel23.setForeground(new java.awt.Color(51, 51, 51));
        jLabel23.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel23.setText("Found Date & Time:");
        jLabel23.setMaximumSize(new java.awt.Dimension(150, 22));
        jLabel23.setMinimumSize(new java.awt.Dimension(150, 22));
        jLabel23.setPreferredSize(new java.awt.Dimension(150, 22));
        jPanel16.add(jLabel23);

        jLabel24.setFont(new java.awt.Font("Calibri", 1, 12));
        jLabel24.setForeground(new java.awt.Color(51, 51, 51));
        jLabel24.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel24.setText("Found by custom regular expression:");
        jLabel24.setMaximumSize(new java.awt.Dimension(150, 22));
        jLabel24.setMinimumSize(new java.awt.Dimension(150, 22));
        jLabel24.setPreferredSize(new java.awt.Dimension(150, 22));
        jPanel16.add(jLabel24);

        jPanel2.add(jPanel16, java.awt.BorderLayout.WEST);

        jPanel17.setBackground(new java.awt.Color(239, 240, 240));
        jPanel17.setLayout(new java.awt.GridLayout(9, 0));

        jPanel18.setBackground(new java.awt.Color(240, 240, 239));
        jPanel18.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(153, 153, 153)));
        jPanel18.setMaximumSize(new java.awt.Dimension(32767, 22));
        jPanel18.setPreferredSize(new java.awt.Dimension(112, 22));
        jPanel18.setLayout(new java.awt.BorderLayout());

        jLabel_totalfiles.setFont(new java.awt.Font("Calibri", 0, 12));
        jLabel_totalfiles.setForeground(new java.awt.Color(102, 102, 102));
        jLabel_totalfiles.setText("Total files:");
        jPanel18.add(jLabel_totalfiles, java.awt.BorderLayout.CENTER);

        jPanel17.add(jPanel18);

        jPanel19.setBackground(new java.awt.Color(240, 240, 239));
        jPanel19.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(153, 153, 153)));
        jPanel19.setMaximumSize(new java.awt.Dimension(32767, 22));
        jPanel19.setPreferredSize(new java.awt.Dimension(112, 22));
        jPanel19.setLayout(new java.awt.BorderLayout());

        jLabel_allconcepts.setFont(new java.awt.Font("Calibri", 0, 12));
        jLabel_allconcepts.setForeground(new java.awt.Color(102, 102, 102));
        jLabel_allconcepts.setText("-");
        jPanel19.add(jLabel_allconcepts, java.awt.BorderLayout.CENTER);

        jPanel17.add(jPanel19);

        jPanel20.setBackground(new java.awt.Color(239, 240, 240));
        jPanel20.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(153, 153, 153)));
        jPanel20.setMaximumSize(new java.awt.Dimension(32767, 22));
        jPanel20.setPreferredSize(new java.awt.Dimension(112, 22));
        jPanel20.setLayout(new java.awt.BorderLayout());

        jLabel_allssn.setFont(new java.awt.Font("Calibri", 0, 12));
        jLabel_allssn.setForeground(new java.awt.Color(102, 102, 102));
        jLabel_allssn.setText("-");
        jPanel20.add(jLabel_allssn, java.awt.BorderLayout.CENTER);

        jPanel17.add(jPanel20);

        jLabel20.setBackground(new java.awt.Color(239, 240, 240));
        jLabel20.setFont(new java.awt.Font("Calibri", 1, 12));
        jLabel20.setForeground(new java.awt.Color(51, 51, 51));
        jLabel20.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel20.setMaximumSize(new java.awt.Dimension(150, 22));
        jLabel20.setMinimumSize(new java.awt.Dimension(150, 22));
        jLabel20.setPreferredSize(new java.awt.Dimension(150, 22));
        jPanel17.add(jLabel20);

        jComboBox_processedfilelist.setBackground(new java.awt.Color(240, 240, 240));
        jComboBox_processedfilelist.setFont(new java.awt.Font("Calibri", 0, 12));
        jComboBox_processedfilelist.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        jComboBox_processedfilelist.setMaximumSize(new java.awt.Dimension(32767, 19));
        jComboBox_processedfilelist.setMinimumSize(new java.awt.Dimension(96, 19));
        jComboBox_processedfilelist.setPreferredSize(new java.awt.Dimension(96, 19));
        jComboBox_processedfilelist.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBox_processedfilelistActionPerformed(evt);
            }
        });
        jPanel17.add(jComboBox_processedfilelist);

        jPanel27.setBackground(new java.awt.Color(240, 240, 239));
        jPanel27.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(153, 153, 153)));
        jPanel27.setMaximumSize(new java.awt.Dimension(32767, 22));
        jPanel27.setPreferredSize(new java.awt.Dimension(112, 22));
        jPanel27.setLayout(new java.awt.BorderLayout());

        jLabel_concepts.setFont(new java.awt.Font("Calibri", 0, 12));
        jLabel_concepts.setForeground(new java.awt.Color(102, 102, 102));
        jLabel_concepts.setText("-");
        jPanel27.add(jLabel_concepts, java.awt.BorderLayout.CENTER);

        jPanel17.add(jPanel27);

        jPanel34.setBackground(new java.awt.Color(240, 240, 239));
        jPanel34.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(153, 153, 153)));
        jPanel34.setMaximumSize(new java.awt.Dimension(32767, 22));
        jPanel34.setPreferredSize(new java.awt.Dimension(112, 22));
        jPanel34.setLayout(new java.awt.BorderLayout());

        jLabel_ssn.setFont(new java.awt.Font("Calibri", 0, 12));
        jLabel_ssn.setForeground(new java.awt.Color(102, 102, 102));
        jLabel_ssn.setText("-");
        jPanel34.add(jLabel_ssn, java.awt.BorderLayout.CENTER);

        jPanel17.add(jPanel34);

        jPanel35.setBackground(new java.awt.Color(240, 240, 239));
        jPanel35.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(153, 153, 153)));
        jPanel35.setMaximumSize(new java.awt.Dimension(32767, 22));
        jPanel35.setPreferredSize(new java.awt.Dimension(112, 22));
        jPanel35.setLayout(new java.awt.BorderLayout());

        jLabel_date.setFont(new java.awt.Font("Calibri", 0, 12));
        jLabel_date.setForeground(new java.awt.Color(102, 102, 102));
        jLabel_date.setText("-");
        jPanel35.add(jLabel_date, java.awt.BorderLayout.CENTER);

        jPanel17.add(jPanel35);

        jPanel36.setBackground(new java.awt.Color(240, 240, 239));
        jPanel36.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(153, 153, 153)));
        jPanel36.setMaximumSize(new java.awt.Dimension(32767, 22));
        jPanel36.setPreferredSize(new java.awt.Dimension(112, 22));
        jPanel36.setLayout(new java.awt.BorderLayout());

        jLabel_customregex.setFont(new java.awt.Font("Calibri", 0, 12));
        jLabel_customregex.setForeground(new java.awt.Color(102, 102, 102));
        jLabel_customregex.setText("-");
        jPanel36.add(jLabel_customregex, java.awt.BorderLayout.CENTER);

        jPanel17.add(jPanel36);

        jPanel2.add(jPanel17, java.awt.BorderLayout.CENTER);

        jPanel1.add(jPanel2);

        jPanel15.setBackground(new java.awt.Color(240, 240, 239));
        jPanel15.setLayout(new java.awt.BorderLayout());

        jPanel22.setBackground(new java.awt.Color(240, 240, 239));
        jPanel22.setLayout(new java.awt.GridLayout(9, 1));

        jLabel15.setFont(new java.awt.Font("Calibri", 1, 12));
        jLabel15.setForeground(new java.awt.Color(51, 51, 51));
        jLabel15.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel15.setText("Total processed files:");
        jLabel15.setMaximumSize(new java.awt.Dimension(150, 22));
        jLabel15.setMinimumSize(new java.awt.Dimension(150, 22));
        jLabel15.setPreferredSize(new java.awt.Dimension(150, 22));
        jPanel22.add(jLabel15);

        jLabel16.setFont(new java.awt.Font("Calibri", 1, 12));
        jLabel16.setForeground(new java.awt.Color(51, 51, 51));
        jLabel16.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel16.setText("Found Date & Time:");
        jLabel16.setMaximumSize(new java.awt.Dimension(150, 22));
        jLabel16.setMinimumSize(new java.awt.Dimension(150, 22));
        jLabel16.setPreferredSize(new java.awt.Dimension(150, 22));
        jPanel22.add(jLabel16);

        jLabel17.setFont(new java.awt.Font("Calibri", 1, 12));
        jLabel17.setForeground(new java.awt.Color(51, 51, 51));
        jLabel17.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel17.setText("Found by custom regular expression:");
        jLabel17.setMaximumSize(new java.awt.Dimension(150, 22));
        jLabel17.setMinimumSize(new java.awt.Dimension(150, 22));
        jLabel17.setPreferredSize(new java.awt.Dimension(150, 22));
        jPanel22.add(jLabel17);

        jPanel15.add(jPanel22, java.awt.BorderLayout.WEST);

        jPanel23.setBackground(new java.awt.Color(240, 240, 239));
        jPanel23.setLayout(new java.awt.GridLayout(9, 0));

        jPanel24.setBackground(new java.awt.Color(240, 240, 239));
        jPanel24.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(153, 153, 153)));
        jPanel24.setMaximumSize(new java.awt.Dimension(32767, 22));
        jPanel24.setPreferredSize(new java.awt.Dimension(112, 22));
        jPanel24.setLayout(new java.awt.BorderLayout());

        jLabel_processedfiles.setFont(new java.awt.Font("Calibri", 0, 12));
        jLabel_processedfiles.setForeground(new java.awt.Color(102, 102, 102));
        jLabel_processedfiles.setText("-");
        jPanel24.add(jLabel_processedfiles, java.awt.BorderLayout.CENTER);

        jPanel23.add(jPanel24);

        jPanel25.setBackground(new java.awt.Color(240, 240, 239));
        jPanel25.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(153, 153, 153)));
        jPanel25.setMaximumSize(new java.awt.Dimension(32767, 22));
        jPanel25.setPreferredSize(new java.awt.Dimension(112, 22));
        jPanel25.setLayout(new java.awt.BorderLayout());

        jLabel_totaldate.setFont(new java.awt.Font("Calibri", 0, 12));
        jLabel_totaldate.setForeground(new java.awt.Color(102, 102, 102));
        jLabel_totaldate.setText("-");
        jPanel25.add(jLabel_totaldate, java.awt.BorderLayout.CENTER);

        jPanel23.add(jPanel25);

        jPanel26.setBackground(new java.awt.Color(240, 240, 239));
        jPanel26.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(153, 153, 153)));
        jPanel26.setMaximumSize(new java.awt.Dimension(32767, 22));
        jPanel26.setPreferredSize(new java.awt.Dimension(112, 22));
        jPanel26.setLayout(new java.awt.BorderLayout());

        jLabel_allcustomregex.setFont(new java.awt.Font("Calibri", 0, 12));
        jLabel_allcustomregex.setForeground(new java.awt.Color(102, 102, 102));
        jLabel_allcustomregex.setText("-");
        jPanel26.add(jLabel_allcustomregex, java.awt.BorderLayout.CENTER);

        jPanel23.add(jPanel26);

        jPanel15.add(jPanel23, java.awt.BorderLayout.CENTER);

        jPanel1.add(jPanel15);

        jPanel4.add(jPanel1, java.awt.BorderLayout.NORTH);

        jTabbedPane1.addTab("Summary", jPanel4);

        jPanel9.setBackground(new java.awt.Color(240, 240, 239));
        jPanel9.setLayout(new java.awt.BorderLayout());

        jScrollPane3.setBackground(new java.awt.Color(238, 238, 238));
        jScrollPane3.setBorder(null);

        jTextPane_log.setBackground(new java.awt.Color(240, 240, 240));
        jTextPane_log.setBorder(null);
        jTextPane_log.setFont(new java.awt.Font("Tahoma", 0, 12));
        jTextPane_log.setDoubleBuffered(true);
        jScrollPane3.setViewportView(jTextPane_log);

        jPanel9.add(jScrollPane3, java.awt.BorderLayout.CENTER);

        jTabbedPane1.addTab("Processing Log", jPanel9);

        jPanel_center.add(jTabbedPane1, java.awt.BorderLayout.CENTER);

        add(jPanel_center, java.awt.BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents

    private void jComboBox_processedfilelistActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox_processedfilelistActionPerformed
        // TODO add your process code here:
        int size = jComboBox_processedfilelist.getItemCount();
        int fileListSize = env.Parameters.corpus.getSize();

        // use this to avoid the initial loading side effect
        if(size!=fileListSize)
            return;

        int selected = jComboBox_processedfilelist.getSelectedIndex();

        if (selected <= (size-1)) {
            //jComboBox_InputFileList.setSelectedIndex(selected + 1);
            ResultEditor.RunningStatus.Status.show(selected);
        } else {
            Toolkit.getDefaultToolkit().beep();
        }
}//GEN-LAST:event_jComboBox_processedfilelistActionPerformed



    /**interrupt current NLP thread*/
    private void jButton_stopActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_stopActionPerformed
        
        if(jButton_stop.getText().trim().compareTo("Stop")==0){
            try{


                jButton_back.setEnabled(true);
                ResultEditor.RunningStatus.Status.setStatus(888);

                Thread.sleep(1000);
                env.Parameters.NLPAssistant.STOPSign = true;
                annotationGenerationThread.interrupt();
                Thread.sleep(300);
                annotationGenerationThread.interrupt();


                
                
            } catch (Exception e) {
                System.out.println("Error throw out while try to stop a thread of outputing annotations." + e.toString());
            }
        }
        // button text is "Go to result Editor"
        else
        {
            __gui.tabDoorman(TabGuard.tabs.resulteditor);
        }

        
    }//GEN-LAST:event_jButton_stopActionPerformed

    private void jButton_backActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_backActionPerformed
        //##2## show another tab
        __gui.enterTab_createAnnotaion();
    }//GEN-LAST:event_jButton_backActionPerformed

    

    public void start()
    {

        this.jButton_back.setEnabled(false);
        //ResultEditor.RunningStatus.Status.startStatusFlash();
        ResultEditor.RunningStatus.Status.setStatus(1);
        jLabel_taskdescription.setText("Initialization Summary Report");
        jLabel_currentcorpusfile.setText(null);
        jProgressBar1.setValue(0);

        // ##<2>## run the thread to create annotaitons
        ResultEditor.RunningStatus.Status status = new ResultEditor.RunningStatus.Status(
                jComboBox_processedfilelist,
                jLabel_totalfiles,
                jLabel_processedfiles,
                this.jLabel_concepts,
                this.jLabel_allconcepts,
                this.jLabel_date,
                this.jLabel_totaldate,
                this.jLabel_ssn,
                this.jLabel_allssn,
                jLabel_customregex,
                jLabel_allcustomregex,
                jLabel_status,
                jLabel_currentcorpusfile,
                jLabel_taskdescription,
                this.jButton_stop,
                this.jButton_back,
                this.__gui
                );



        ResultEditor.RunningStatus.Status.reset();
        resetRunningStatus();
        
        jLabel_taskdescription.setText("Reset Pre-Annotated Dictionary");        
        // clear concept dictionaries
        Dictionaries.ConceptDictionaries.clear();

        Logs.ShowLogs.cleanTextArea();

        jProgressBar1.setMaximum(100);
        jProgressBar1.setValue(0);

        jComboBox_processedfilelist.setEnabled(false);

        // -------------------------------------------------------- //
        // **** start analysis
        annotationGenerationThread = new Thread()
        {
            @Override
            public void run() {
                NLP.Starting.Loading.Loading_and_Processing( env.Parameters.NLPAssistant.outputpath );
            }
        };
        annotationGenerationThread.start();
        // -------------------------------------------------------- //
        return;
    }


    private void resetRunningStatus()
    {
        jComboBox_processedfilelist.removeAllItems();
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton_back;
    private javax.swing.JButton jButton_stop;
    private javax.swing.JComboBox jComboBox_processedfilelist;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel jLabel_allconcepts;
    private javax.swing.JLabel jLabel_allcustomregex;
    private javax.swing.JLabel jLabel_allssn;
    private javax.swing.JLabel jLabel_concepts;
    private javax.swing.JLabel jLabel_currentcorpusfile;
    private javax.swing.JLabel jLabel_customregex;
    private javax.swing.JLabel jLabel_date;
    private javax.swing.JLabel jLabel_processedfiles;
    private javax.swing.JLabel jLabel_s;
    private javax.swing.JLabel jLabel_ssn;
    private javax.swing.JLabel jLabel_status;
    private javax.swing.JLabel jLabel_t;
    private javax.swing.JLabel jLabel_taskdescription;
    private javax.swing.JLabel jLabel_totaldate;
    private javax.swing.JLabel jLabel_totalfiles;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel14;
    private javax.swing.JPanel jPanel15;
    private javax.swing.JPanel jPanel16;
    private javax.swing.JPanel jPanel17;
    private javax.swing.JPanel jPanel18;
    private javax.swing.JPanel jPanel19;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel20;
    private javax.swing.JPanel jPanel22;
    private javax.swing.JPanel jPanel23;
    private javax.swing.JPanel jPanel24;
    private javax.swing.JPanel jPanel25;
    private javax.swing.JPanel jPanel26;
    private javax.swing.JPanel jPanel27;
    private javax.swing.JPanel jPanel34;
    private javax.swing.JPanel jPanel35;
    private javax.swing.JPanel jPanel36;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JPanel jPanel_Buttom;
    private javax.swing.JPanel jPanel_center;
    private javax.swing.JPanel jPanel_left;
    private javax.swing.JPanel jPanel_right;
    private javax.swing.JPanel jPanel_top;
    private javax.swing.JPanel jPanel_topbackground;
    private javax.swing.JPanel jPanel_topbound;
    public static javax.swing.JProgressBar jProgressBar1;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTabbedPane jTabbedPane1;
    public static javax.swing.JTextPane jTextPane_log;
    // End of variables declaration//GEN-END:variables

}
